#celery.py
from __future__ import absolute_import
 
import os
from celery import Celery, platforms
from django.conf import settings
 
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'examples_of_timing_tasks.settings') #examples_of_timing_tasks是项目名称
 
app = Celery('examples_of_timing_tasks')
platforms.C_FORCE_ROOT = True
 
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
app.conf.update(
    BROKER_URL=settings.BROKER_URL,

)
 
@app.task(bind=True)
def test(self,info):
    print(info)
    print('222222222222222222222222222')